<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>登录</title>
    <link rel="stylesheet" href="/pear/css/pear.css" />
    <link rel="stylesheet" href="/assets/css/other/login.css" />
    <link rel="stylesheet" href="/assets/css/variables.css" />
    <script>if (window.self != window.top) { top.location.reload(); }</script>
</head>

<body>
    <div class="login-page" style="background-image: url(/assets/images/logo_bg.jpg)">
        <div class="layui-row">
            <div class="layui-col-sm6 login-bg layui-hide-xs">
                <img class="login-bg-img" src="/assets/images/banner.png" alt="" />
            </div>
            <div class="layui-col-sm6 layui-col-xs12 login-form">
                <form class="layui-form">
                    <div class="form-center">
                        <div class="form-center-box">
                            <div class="top-log-title">
                                <img class="top-log" src="/assets/images/logo.png" alt="" />
                                <span>KingBes Admin</span>
                            </div>
                            <div class="top-desc">
                                仅 仅 只 是 浑 水 摸 鱼 罢 了 哈 哈
                            </div>
                            <div style="margin-top: 30px;">
                                <div class="layui-form-item">
                                    <div class="layui-input-wrap">
                                        <div class="layui-input-prefix">
                                            <i class="layui-icon layui-icon-username"></i>
                                        </div>
                                        <input name="username" lay-verify="required" placeholder="账号"
                                            class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-wrap">
                                        <div class="layui-input-prefix">
                                            <i class="layui-icon layui-icon-password"></i>
                                        </div>
                                        <input type="password" name="password" value="" lay-verify="required"
                                            placeholder="密码" class="layui-input" lay-affix="eye">
                                    </div>
                                </div>
                                <div class="tab-log-verification">
                                    <div class="verification-text">
                                        <div class="layui-input-wrap">
                                            <div class="layui-input-prefix">
                                                <i class="layui-icon layui-icon-auz"></i>
                                            </div>
                                            <input type="text" name="captcha" lay-verify="required" value=""
                                                placeholder="验证码" class="layui-input">
                                        </div>
                                    </div>
                                    <img src="{:route('admin.login.captcha')}" class="verification-img" />
                                </div>
                                <div class="layui-form-item">
                                    <div class="remember-passsword">
                                        <div class="remember-cehcked">
                                            <input type="checkbox" lay-skin="primary" title="自动登录">
                                        </div>
                                    </div>
                                </div>
                                <div class="login-btn">
                                    <button type="submit" lay-submit lay-filter="login" class="layui-btn login">登
                                        录</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- 资 源 引 入 -->
    <script src="/layui/layui.js"></script>
    <script src="/pear/pear.js"></script>
    <script>
        layui.use(['form', 'jquery'], function () {
            let form = layui.form;
            let $ = layui.$

            $(".verification-img").on("click", function () {
                $(this).attr("src", "{:route('admin.login.captcha')}" + "?" + Math.random())
            })

            // 登 录 提 交
            form.on('submit(login)', function (data) {
                $.post("{:route('admin.login.index')}", data.field, function (res) {
                    layer.msg(res.msg, { icon: res.code }, function () {
                        if (res.code == 1) {
                            window.location.href = res.url;
                        } else {
                            window.location.reload()
                        }
                    });
                })
                return false;
            });
        })
    </script>
</body>

</html>